<template>
  <a-card>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane key="1" tab="生成条码">
        <DeliveryCodeList ref="deliveryCodeListRef">
          <template #action>
            <a-space align="center">
              <a-button v-if="isEdit" icon="edit" @click="handleEdit()">
                编辑数量
              </a-button>
              <a-button
                v-else
                :style="{ backgroundColor: '#2ed573', borderColor: '#2ed573' }"
                type="primary"
                icon="save"
                @click="handleSave()"
              >
                保存
              </a-button>
              <a-button type="primary" @click="handleGenerate('100x80')">
                生成标签(100x80)
              </a-button>
              <a-button type="primary" @click="handleGenerate('2x2')">
                生成标签(2x2)
              </a-button>
              <a-button type="primary" @click="handleGenerate('2x3')">
                生成标签(2x3)
              </a-button>
              <a-button icon="reset" type="primary" @click="handleReset()">
                重置
              </a-button>
            </a-space>
          </template>
        </DeliveryCodeList>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>
import BatchGenerateBarcode from '@views/code/modules/BatchGenerateBarcode.vue'
import HfBatchSelectTransfer from '@comp/HfManual/HfBatchSelectTransfer.vue'
import DeliveryCodeList from '@views/code/DeliveryCodeList.vue'


export default {
  name: 'OutboundCodePrint',
  components: {
    DeliveryCodeList,
    HfBatchSelectTransfer,
    BatchGenerateBarcode
  },
  data() {
    return {
      loading: false,
      isEdit: false,
      dataUrl: '/purchase/hfPurchasePrice/codePrintList'
    }
  },
  watch: {},
  methods: {
    handleEdit() {
      this.isEdit = this.$refs.deliveryCodeListRef.edit()
    },
    handleSave() {
      this.isEdit = this.$refs.deliveryCodeListRef.save()
    },
    handleReset() {
      this.isEdit = false
      this.$refs.deliveryCodeListRef.handleReset()
    },
    handleGenerate(type) {
      this.$refs.deliveryCodeListRef.handleGenerate(type)
    }
  }
}
</script>
<style scoped></style>
